Skip to content

Visualizer: no step for -x where it reads as its value; console check without buttons - #50

Merged
cedricvogel-leo merged 1 commit into
mainfrom
feature/unary-minus-name
Nov 4, 2026
Merged

cedricvogel-leo merged 1 commit into
mainfrom
feature/unary-minus-name

Conversation

@cedricvogel-leo

Copy link
Copy Markdown
Collaborator

Follow-ups from #48, as decided. This PR stacks on #48: merge #48 first. GitHub then retargets this PR to main, or if the branch isn't deleted, I'll rebase it.

What

-x (every step changes something, as in P40). Unary minus on a name no longer gets its own step when the line already reads as the value once the name is replaced:

  • -x with x = 7 is one step: x → 7, so the line reads -7. Before, a second step -7 → -7 followed that changed nothing.
  • -x with x = 2.5 likewise.
  • The minus keeps its step where it changes the text:
    • -x with x = -7 goes --7 → 7;
    • -x with x = True goes -True → -1.
  • Unchanged, by decision:
    • -(a + b) keeps its step -3 → -3; the rule is for names only;
    • +3 keeps its step +3 → 3.

The P36 input() browser check reads the console's transcript without the entries' «Visualisieren» buttons. Depending on the width, a button sits next to its >>> line or wraps onto a line of its own. In CI it had wrapped, so >>> repl()\nVisualisieren\n> 1 + 2… didn't match. consoleText now hides the buttons while it reads the text. That covers every check that reads the console.

Checks

  • scripts/check-runtime-lists.py covers -x with 7, 2.5, -7 and True, and -(a + b). The P40 case (n, -n, {n: [n]}) now has no step for -n.
  • Locally, lint, test:runtime and test:console pass.

How it goes live

  • Courses: merging to main deploys the embed, so the courses get it straight away.
  • IDE: it needs a tag, v0.1.25 or v0.1.24 if it's merged before you set that one, and then the IDE bump.

Manual tests (desktop, and iPad with an external keyboard)

  1. Visualize x = 7 then w = -x, in Ersetzung and Kasten. Line 2 has one substitution (w = -7), then the assignment.
  2. Visualize x = -7 then w = -x. Line 2 shows w = --7, then w = 7.
  3. Visualize a = 1, b = 2, w = -(a + b). As before, the minus keeps its step.

Follow-up (not fixed)

  • not x is labelled not7 in the trace: the space after not is missing. Shown in the step label and in Copy → chain. It's pre-existing.

🤖 Generated with Claude Code

…ck without buttons

"-x" with x = 7 reads "-7" once x is replaced, so the minus records no step
of its own; "--7" and "-True" keep theirs. The browser check's console text
leaves out the entries' Visualize buttons, which land next to a ">>>" line or
on a line of their own depending on the width.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cedricvogel-leo
cedricvogel-leo changed the base branch from feature/literal-displays to main November 4, 2026 23:54
@cedricvogel-leo
cedricvogel-leo merged commit a8cabe2 into main Nov 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant